<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="commonJS::commonJsCss('权限管理')">
    <title>权限管理</title>
</head>
<body ng-app="permissionApp" ng-controller="permissionCtrl" ng-init="init()">
<!--通用头部-->
<div th:replace="head::header" ></div>
<div th:replace="menu::menu" ></div>
<div style="height: 91%;background-color: #ffffff;">
    <div class="form-query"style="background-color: #dfe2e4;width: 88%;">
        <table class="div_form_table">
            <tr>
                <td class="div_form_middle_title" style="text-align: left;">
                    类型：
                    <select id="contractUserTypeSel" style="width: 150px;height: 30px;" onchange="angular.element(this).scope().getContractUsersByUserType()">
                        <option value=""><--请选择--></option>
                        <option value="2">航司</option>
                        <option value="1">机场</option>
                    </select>
                    合同用户：
                    <select id="contractUserSel" style="width: 150px;height: 30px;">
                        <option value=""><--请选择--></option>
                        <option th:each="contractUser : ${contractUserList}" th:value="${contractUser.contractUserId}" th:text="${contractUser.userAbbrev}" />
                    </select>
                    <button class="form-btn-edit" data-ng-click="loadContractUsers()">查询</button>
                </td>
            </tr>
        </table>
    </div>

    <div class="form-table" style="width: 88%;min-height: 605px;">
        <!--表格+条件查询+关联+分页-->
        <div class="billingrule_table_div">
            <div class="form-table" style="margin: 20px;" id="printpart">
                <!--表格加分页：inline-block使分页在表格下-->
                <div class="page-in-table">
                    <!--表格-->
                    <table class="efbtable">
                        <thead>
                        <tr>
                            <th class="efbth" style="width: 45%">合同用户名</th>
                            <th class="efbth" style="width: 45%">类型</th>
                            <th class="efbth" style="width: 10%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="contractUser in contractUsers">
                            <td class="efbTable-border"><span>{{contractUser.userAbbrev}}</span></td>
                            <td class="efbTable-border"><span>{{contractUser.userType == 1 ? "机场" : "航司"}}</span></td>
                            <td class="efbTable-border"><button class="form-btn-edit" data-ng-click="toEditPermission(contractUser.contractUserId)">权限</button></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <!-- 分页 :共用page.html-->
                <div th:replace="newPage::newPagehtml"></div>
            </div>
        </div>
    </div>
</div>

<!--设置权限-->
<div class="modal fade" tabindex="-1" role="dialog" id="editPermissionModal">
    <div class="modal-dialog" role="document" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header modal-header-efb">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title modal-title-efb">设置权限</h4>
            </div>
            <div id="loadPermission" class="modal-body" style="max-height: 605px;overflow: auto">
                <div class="row-fluid">
                    <div class="span12">
                        <ul id="editPermissionTree" class="ztree billingrule_ztree_ul"></ul>
                    </div>
                </div>
            </div>
            <div class="modal-footer modal-footer-efb">
                <input type="text" data-ng-show="false" id="contractUserId" name="contractUserId" data-ng-model="contractUserId"/>
                <button type="button" class="form-btn-edit" data-ng-click="editPermissions()">确定</button>
                <button type="button" class="form-btn-cancel" data-ng-click="closeEditPermissionModal()">取消</button>
            </div>
        </div>
    </div>
</div>

<!--通用尾部-->
<div th:replace="footer::footer" ></div>
</body>
<script type="text/javascript" th:src="@{/js/permission/PermissionModule.js}"></script>
<script type="text/javascript" th:src="@{/js/common/cookieUtil.js}"></script>
<script type="text/javascript" th:src="@{/js/permission/PermissionService.js}"></script>
<script type="text/javascript" th:src="@{/js/permission/PermissionController.js}"></script>

<!--js引用：只写自己需要的js-->
<link rel="stylesheet" type="text/css" th:href="@{/zTree/zTreeStyle.css}"/>

<script type="text/javascript" th:src="@{/zTree/jquery.ztree.core-3.5.js}"></script>
<script type="text/javascript" th:src="@{/zTree/jquery.ztree.excheck-3.5.js}"></script>
<script type="text/javascript" th:src="@{/zTree/jquery.ztree.exedit.js}"></script>
<script type="text/javascript" th:src="@{/zTree/highlight.min.js}"></script>
<script type="text/javascript" th:src="@{/zTree/jQuery-contextMenujstheme.js}"></script>
<script type="text/javascript" th:src="@{/zTree/Query-contextMenudistjquery.contextMenu.js}"></script>
<script type="text/javascript" th:src="@{/zTree/jQuery-contextMenudistjquery.ui.position.min.js}"></script>
<script type="text/javascript" th:src="@{/zTree/jQuery-contextMenujsmain.js}"></script>
<script th:inline="javascript">
    var type = [[${contractUserList}]];
    if(type.length==1){
        $("#contractUserSel").val(type[0].contractUserId);
    }
</script>
</html>